﻿package mortal.game.view.chat.selectPanel
{
    import com.mui.controls.*;
    import com.mui.display.*;
    import flash.events.*;
    import mortal.component.gconst.*;
    import mortal.game.events.*;
    import mortal.game.mvc.*;

    public class ColorItem extends GSprite
    {
        private var _bitmap:ScaleBitmap;
        private var color:uint;

        public function ColorItem(param1:uint)
        {
            this.color = param1;
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this.mouseEnabled = true;
            this._bitmap = ResourceConst.getScaleColor(this.color, 0, 0, 30, 20, this);
            this.configEventListener(MouseEvent.CLICK, this.onColorItemClickHandler);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            this._bitmap.dispose(param1);
            this._bitmap = null;
            return;
        }// end function

        private function onColorItemClickHandler(event:MouseEvent) : void
        {
            dispatchEvent(new DataEvent(EventName.ChatColorSelect, this.color));
            return;
        }// end function

    }
}
